from rest_framework import serializers
from sciencePopularization.models import SciencePopularizationDirection, PopularScienceArticle

# 科普文章方向序列化器
class SciencePopularizationDirectionSerializer(serializers.ModelSerializer):
    class Meta:
        model = SciencePopularizationDirection
        fields = [
            'id', 
            'name'
        ]

# 科普文章内容序列化器
class PopularScienceArticleSerializer(serializers.ModelSerializer):
    class Meta:
        model = PopularScienceArticle
        fields = [
            'id', 
            'title', 
            'content', 
            'author', 
            'publish_date', 
            'image', 
            'external_links', 
            'copyright', 
            'recommend_home'
        ]